package com.heima.search.colltroller;

import com.heima.model.common.dtos.ResponseResult;
import com.heima.model.common.search.pojo.ArticleDoc;
import com.heima.model.common.search.dto.SearchDto;
import com.heima.search.service.SerchService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.io.IOException;
import java.util.List;

@RestController
@RequestMapping("/api/v1/article/search")
public class SearchColltroller {
    @Autowired
    private SerchService serchService;
     //搜索功能
    @PostMapping("/search")
    public ResponseResult<List<ArticleDoc>> search(@RequestBody SearchDto dto) throws IOException {
        return serchService.search(dto);
    }

}
